package com.yizhuoyan.his.webapi.controller.department;

import com.yizhuoyan.his.ao.DepartmentAo;
import com.yizhuoyan.his.dto.JSONResponse;
import com.yizhuoyan.his.qco.DepartmentQueryQco;
import com.yizhuoyan.his.service.department.DepartmentManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DepartmentManageController {

    @Autowired
    DepartmentManageService service;

    @PostMapping("/api/addDepartment")
    public JSONResponse addDepartment(DepartmentAo ao)throws Exception{
        service.addDepartment(ao);
        return JSONResponse.ok();
    }
    @PostMapping("/api/modifyDepartment")
    public JSONResponse modifyDepartment(Long id,DepartmentAo ao)throws Exception{
        service.modifyDepartment(id,ao);
        return  JSONResponse.ok();
    }
    @PostMapping("/api/queryDepartments")
    public JSONResponse queryDepartments(Long id, DepartmentQueryQco qco)throws Exception{
        service.queryDepartments(qco);
        return JSONResponse.ok();
    }
    @PostMapping("/api/removeDepartmentById")
    public JSONResponse removeDepartmentById(Long id)throws Exception{
        service.removeDepartmentById(id);
        return  JSONResponse.ok();
    }
}
